package l.l.w.CodingInterviews;

import java.util.Scanner;

/**
 * Created by llw on 2018/4/19/0019.
 */
public class 使三个数相等 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int C = scanner.nextInt();
        int result = new 使三个数相等().minTimes2Equal(A, B, C);
        System.out.println(result);
    }
    public int minTimes2Equal(int A, int B, int C){
        int result = 0;
        if(A < B){
            int temp = A;
            A = B;
            B = temp;
        }
        if(A <C){
            int temp = A;
            A= C;
            C = temp;
        }
        int k = (A - B)/2;
        result += k;
        B += 2 * k;
        k = (A - C)/2;
        result += k;
        C += 2 * k;
        if(C > B){
            int temp = B;
            B = C;
            C = temp;
        }
        if(A == B && A == C)return  result;
        if(A == B) return result + 2;
        return result+1;
    }


}
